﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace PictureOrganizer2.DataContainer
{
    public class AppSettingsContainer
    {
        private Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

        public void SaveConfig()
        {
            config.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");
        }

        public string MaxFolderDeep
        {
            get { return config.AppSettings.Settings["MaxFolderDeep"].Value; }
            set
            {
                config.AppSettings.Settings.Remove("MaxFolderDeep");
                config.AppSettings.Settings.Add("MaxFolderDeep", value);
            }
        }

        public string FileSearchPattern
        {
            get { return config.AppSettings.Settings["FileSearchPattern"].Value; }
            set
            {
                config.AppSettings.Settings.Remove("FileSearchPattern");
                config.AppSettings.Settings.Add("FileSearchPattern", value);
            }
        }

        public string FileSearchPatternSeperator
        {
            get { return config.AppSettings.Settings["FileSearchPatternSeperator"].Value; }
            set
            {
                config.AppSettings.Settings.Remove("FileSearchPatternSeperator");
                config.AppSettings.Settings.Add("FileSearchPatternSeperator", value);
            }
        }

        public string ComicsPerPage
        {
            get { return config.AppSettings.Settings["ComicsPerPage"].Value; }
            set
            {
                config.AppSettings.Settings.Remove("ComicsPerPage");
                config.AppSettings.Settings.Add("ComicsPerPage", value);
            }
        }

        public string GroupBy
        {
            get { return config.AppSettings.Settings["GroupBy"].Value; }
            set
            {
                config.AppSettings.Settings.Remove("GroupBy");
                config.AppSettings.Settings.Add("GroupBy", value);
            }
        }
    }
}
